<?php
/**
* UTF-8
*
* @param mixed $string
* @return mixed
*/
function encodingUTF8($string){
	$fs = "utf-8";
	$ts = "euc-kr";
	if($string === mb_convert_encoding ( mb_convert_encoding ( $string, $fs, $ts ), $ts, $fs )){
		$string = iconv($ts, $fs, $string);
	}

	return $string;
}

/**
 * mongoDate to time
 */
function mongoDateToTime($_mongo_date, $_flag = true)
{
    $time = 0;
    foreach($_mongo_date as $key => $value)
    {
        if($key == 'sec')
        {
            $time = $value;
            break;
        }
    }

    if($_flag == true)
    {
        return mkTimeToDate($time);
    }
    else
    {
        return $time;
    }

}

function mkTimeToDate($_mongo_date)
{
    $time = date('Y-m-d H:i:s', $_mongo_date);
    return $time;
}

function idCheck($_array, $_db, $_game_db)
{
    foreach($_array as $data)
    {
        $check[] = $_game_db->id_check($_db, $data['Id']);
    }

    return $check;
}
